OAuthable concern now uses class instance variables

Dominik Sander 10 年之前
父節點
當前提交
f705963e09
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      app/concerns/oauthable.rb

+ 4 - 3
app/concerns/oauthable.rb

@@ -2,9 +2,9 @@ module Oauthable
2 2
   extend ActiveSupport::Concern
3 3
 
4 4
   included do |base|
5
+    @valid_oauth_providers = :all
5 6
     attr_accessible :service_id
6 7
     validates_presence_of :service_id
7
-    self.class_variable_set(:@@valid_oauth_providers, :all)
8 8
   end
9 9
 
10 10
   def oauthable?
@@ -20,12 +20,13 @@ module Oauthable
20 20
   end
21 21
 
22 22
   def valid_oauth_providers
23
-    self.class.class_variable_get(:@@valid_oauth_providers)
23
+    self.class.valid_oauth_providers
24 24
   end
25 25
 
26 26
   module ClassMethods
27 27
     def valid_oauth_providers(*providers)
28
-      self.class_variable_set(:@@valid_oauth_providers, providers)
28
+      return @valid_oauth_providers if providers == []
29
+      @valid_oauth_providers = providers
29 30
     end
30 31
   end
31 32
 end